package com.zh.note.huawei.onehundred.运动会按身高和体重排队;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @Author: zhanghuan
 * @date: 2023/9/2 20:31
 * @description: create it
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // int n = sc.nextInt();
        // String str1 = sc.nextLine();
        // String str2 = sc.nextLine();
        int n = 4;
        String str1 = "100 100 140 130";
        String str2 = "50 50 60 50";
        String[] height = str1.split(" ");
        String[] weight = str2.split(" ");
        int[][] people = new int[n][3];
        for (int i = 0; i < n; i++) {
            people[i][0] = i + 1;
            people[i][1] = Integer.parseInt(height[i]);
            people[i][2] = Integer.parseInt(weight[i]);
        }
        Arrays.sort(people, (o1, o2) -> {
            if (o1[1] == o2[1]) { //判断升高是否相同
                return o1[2] - o2[2]; // 体重
            } else {
                return o1[1] - o2[1]; //身高
            }

        });
        for (int i = 0; i < n; i++) {
            System.out.print(people[i][0]);
            if (i != n - 1) {
                System.out.print(" ");
            }
        }
    }

}
